#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


  byte buf[256],
	     data;

  long posi,
	     ofs;

  int  c,
	     p;
  word val;

	FILE *tf,
	     *cf;

int main( )
{

  tf = fopen( "c:/romhack/trans/free6/bin/slim8x8.bin","rb");
  cf = fopen( "c:/romhack/trans/free6/bin/slim8x8.4bp","wb");

  if ( !tf || !cf ) return -1;
  //
  fseek( tf, 0, SEEK_END );
  posi = ftell( tf );
  fseek( tf, 0, SEEK_SET );
  //
  c = -1;
  //
  while( ++c < posi )
  { //
    memset( buf, 0, 16 );
    p = -1;
    while( ++p < 8 )
    {
      data = fgetc( tf );
      buf[ p+p+0 ] = ((data>>1) ^ 0xFF) | data;
//      buf[ p+p+1 ] = data;

      //
      fputc( (data >> 1) | data, cf );
      fputc( ((data >> 1) | data) ^ data , cf );
    }
    //
    fwrite( buf, 1, 16, cf );

  }


  fcloseall( );
  return 0;
}

